/*
 * CLight.cpp
 *
 *  Created on: Sep 19, 2011
 *      Author: welcome
 */

#include "CLight.h"

namespace GGEngine {

CLight::CLight() :
		m_position(KD_NULL), m_ambient(KD_NULL), m_diffuse(KD_NULL), m_specular(
				KD_NULL), m_emission(KD_NULL) {
}

CLight::~CLight() {
}

GLfloat *CLight::getAmbient() const {
	return m_ambient;
}

GLfloat *CLight::getDiffuse() const {
	return m_diffuse;
}

GLfloat *CLight::getEmission() const {
	return m_emission;
}

GLfloat *CLight::getPosition() const {
	return m_position;
}

GLfloat *CLight::getSpecular() const {
	return m_specular;
}

void CLight::setAmbient(GLfloat *m_ambient) {
	this->m_ambient = m_ambient;
}

void CLight::setDiffuse(GLfloat *m_diffuse) {
	this->m_diffuse = m_diffuse;
}

void CLight::setEmission(GLfloat *m_emission) {
	this->m_emission = m_emission;
}

void CLight::setPosition(GLfloat *m_position) {
	this->m_position = m_position;
}

void CLight::setSpecular(GLfloat *m_specular) {
	this->m_specular = m_specular;
}
void CLight::initLight() {
    glEnable(GL_LIGHT0);

    if (m_position != NULL)
        glLightfv(GL_LIGHT0, GL_POSITION, m_position);

    if (m_ambient != NULL)
        glLightfv(GL_LIGHT0, GL_AMBIENT, m_ambient);

    if (m_diffuse != NULL)
        glLightfv(GL_LIGHT0, GL_DIFFUSE, m_diffuse);

    if (m_specular != NULL)
        glLightfv(GL_LIGHT0, GL_SPECULAR, m_specular);

    if (m_emission != NULL)
        glLightfv(GL_LIGHT0, GL_EMISSION, m_emission);
}
} /* namespace GGEngine */
